﻿<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Style x:Key="WatermarkTextBoxStyle" TargetType="{x:Type TextBox}">
        <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
        <Setter Property="BorderBrush" Value="{StaticResource ListBorder}"/>
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
        <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="Padding" Value="2"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="AllowDrop" Value="true"/>
        <Setter Property="Template" Value="{DynamicResource WatermarkTextBoxTemplate}"/>
        <Setter Property="Validation.ErrorTemplate">
            <Setter.Value>
                <ControlTemplate>
                    <DockPanel LastChildFill="True">
                        <Border DockPanel.Dock="Bottom" 
                                HorizontalAlignment="Right"
                                BorderBrush="Red" 
                                BorderThickness="{StaticResource ThicknessSize_1}"  
                                CornerRadius="0,0,3,3"
                                Background="Red">
                            <TextBlock Foreground="White"
                                       FontSize="12"
                                       Text="{Binding ElementName=adornerElement, Path=AdornedElement.(Validation.Errors).CurrentItem.ErrorContent}"
                                       Margin="1,1,1,1"/>
                        </Border>
                        <Border BorderBrush="Red" 
                                BorderThickness="{StaticResource ThicknessSize_1}"  
                                CornerRadius="3,3,0,3">
                            <AdornedElementPlaceholder Name="adornerElement">
                            </AdornedElementPlaceholder>
                        </Border>
                    </DockPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <!--<Style.Triggers>
            <Trigger Property="Validation.HasError" Value="true">
                <Setter Property="ToolTip"
					Value="{Binding (Validation.Errors).CurrentItem.ErrorContent, RelativeSource={x:Static RelativeSource.Self}}"/>
            </Trigger>
        </Style.Triggers>-->
    </Style>
    <ControlTemplate x:Key="WatermarkTextBoxTemplate" TargetType="{x:Type TextBox}">
        <Border x:Name="Bd" SnapsToDevicePixels="true" BorderThickness="{DynamicResource ThicknessSize_1}" Background="{DynamicResource BrushControlBackgroundLight}" BorderBrush="{DynamicResource ImpassiveColor4}" CornerRadius="{DynamicResource CornerRadiusSmall}">
            <ScrollViewer x:Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Style="{DynamicResource ScrollViewerListViewStyle}"/>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="IsEnabled" Value="false">
                <Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
    <!-- Resource dictionary entries should be defined here. -->
</ResourceDictionary>